import datetime,pickle
import os
fileName='last_run.pkl'

first_time=True
if os.path.isfile(fileName):
    pickle_file=open(fileName,'rb')
    last_time=pickle.load(pickle_file)
    pickle_file.close()
    print('项目最后的运行时间是：',last_time)
    first_time=False

pickle_file=open(fileName,'wb')
nowTime=datetime.datetime.now()
strNowTime=nowTime.strftime("%Y-%m-%d %X")
pickle.dump(strNowTime,pickle_file)
pickle_file.close()
if first_time:
    print('创建一个新的pickle文件。')
